<!DOCTYPE html>
<html lang="zh"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加资讯</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../../css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form layui-row layui-col-space10">
    <div class="layui-col-md12 layui-col-xs12">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12 layui-col-xs7">
                <div class="layui-form-item magt3">
                    <label class="layui-form-label">资讯标题</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input" AUTOCOMPLETE="off" name="infTitle" lay-verify="infTitle" placeholder="请输入资讯标题">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item magb0">
            <label class="layui-form-label">资讯内容</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" name="infContext" AUTOCOMPLETE="off" lay-verify="infContext" id="notice_content"></textarea>
            </div>
        </div>
        <hr class="layui-bg-gray" />
        <div class="layui-col-md4 layui-col-md-offset8 layui-col-xs12">
            <div class="layui-right">
                <a class="layui-btn layui-btn-sm" lay-filter="addInformation" lay-submit><i class="layui-icon">&#xe609;</i>发布</a>
                <!--<a class="layui-btn layui-btn-primary layui-btn-sm" lay-filter="look" lay-submit>预览</a>-->
            </div>
        </div>
    </div>

</form>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['form','layer','layedit','laydate','upload'],function(){
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            laypage = layui.laypage,
            upload = layui.upload,
            layedit = layui.layedit,
            laydate = layui.laydate,
            $ = layui.jquery;
        /**
         * 添加公告
         */
        form.on("submit(addInformation)",function(data){
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            var obj = data.field;
            /**
             * 请求后台
             */
            $.ajax({
                type:'POST',
                url:'/information/addInformation',
                data:JSON.stringify(obj),
                dataType:'json',
                contentType:'application/json',
                success:function (data) {
                    /**
                     * 添加成功后回调
                     **/
                    setTimeout(function(){
                        top.layer.close(index);
                        top.layer.msg("发布成功！");
                        layer.closeAll("iframe");
                        //刷新父页面
                        parent.location.reload();
                    },500);
                    return false;
                }
            });


            /* $.post("/notice/addNotice",{

             },function(res){});*/
        });
    });
</script>
</body>
</html>